package Integrity;


public class ResultFactory {
	ResultFactory (String ui,int ri, String ret ,String bsi,Xml_Extracted_Data xtract){
		 ResultID = ri;
		 UserID = ui;
		 BillingSiteID = bsi;
		 resultErrorType = ret;
		 extract = xtract;
		
	}
	public Result createResult() throws Exception{
		if (resultErrorType.equals("NONE")||resultErrorType.equals("DIC")){
			String type = extract.get_scraped_type();
			if (type.equals("telco")) r = new TelcoResult(UserID,ResultID,BillingSiteID,extract);
			else if (type.equals("municipality"))r = new MunicipalityResult(UserID,ResultID,BillingSiteID,extract);
			else if (type.equals("credit")) r = new CreditResult(UserID,ResultID,BillingSiteID,extract);
			else throw new Exception("Invalid Service provider type");
		}
		else r = new Result (UserID,ResultID,BillingSiteID,extract);
		
		return r;
	}
	
	 private Result r;
	 private int ResultID;
	 private String UserID;
        private String BillingSiteID;
	 private String resultErrorType;
	 Xml_Extracted_Data extract;
}
